<?php
/**
 * This file is part of webman.
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the MIT-LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @author    walkor<walkor@workerman.net>
 * @copyright walkor<walkor@workerman.net>
 * @link      http://www.workerman.net/
 * @license   http://www.opensource.org/licenses/mit-license.php MIT License
 */

use app\controller\IndexController;
use app\controller\LogsController;
use app\controller\RoomController;
use app\controller\WebsocketController;
use app\controller\WebsocketLogsController;
use Webman\Route;



Route::post("/ws/send",[WebsocketController::class,"send"]);


Route::group("/api",function (){

    Route::post("/login",[IndexController::class,"login"]);

    Route::post("/register",[IndexController::class,"register"]);

    Route::group("/device/card",function (){

    });

    Route::group("/room",function (){
        Route::post("/test",[IndexController::class,'index']);
        Route::post("/add",[RoomController::class,"add"]);
        Route::post("/delete",[RoomController::class,"delete"]);
        Route::post("/list",[RoomController::class,"list"]);
        Route::post("/edit",[RoomController::class,"edit"]);
    })->middleware([
        \app\middleware\Auth::class
    ]);

    Route::group("/logs",function (){
       Route::group("/websocket",function (){
           Route::post("/list",[WebsocketLogsController::class,"list"]);
       });
       Route::post("/list",[LogsController::class,"list"]);
       Route::post("/type_list",[LogsController::class,"type_list"]);
    });

    Route::group("/ws",function (){
        //发到机房的数据
    });

    Route::post("/test",[IndexController::class,"test"]);


    Route::group("/device",function (){
        //读卡器扫码上传
       Route::post("/udp_scan",[\app\controller\DeviceController::class,"udp_scan"]);
       //发送准备游戏的数据后，返回用户开始游戏或开始游戏超时
       Route::post("/begin_action",[\app\controller\DeviceController::class,"begin_action"]);
       //用户是否晋级或退出
       Route::post("/use_action",[\app\controller\DeviceController::class,"use_action"]);
       //用户成绩
       Route::post("/user_score",[\app\controller\DeviceController::class,"use_score"]);
       Route::post("/check_key",[\app\controller\DeviceController::class,"check_key"]);

       Route::group("/room",function (){
          Route::post("/ready",[\app\controller\RoomDeviceController::class,"ready"]);
          Route::post("/init_user",[\app\controller\RoomDeviceController::class,"init_user"]);
       });

    });


});





